#!/usr/bin/python3
# -*- coding:utf-8 -*-


import jaydebeapi

from .basic import DatabaseUtil


class DaMengUtil(DatabaseUtil):

    def __init__(self, user, password, ip, port=5236, **kwargs):
        self.CURSOR = {}
        server = kwargs.get('server')
        jclassname = 'dm.jdbc.driver.DmDriver'
        url = f"jdbc:dm://{ip}:{port}"
        driver_args = [user, password]
        jar_ile = kwargs.get('jar_files')
        self.db = jaydebeapi.connect(jclassname, url, driver_args, jar_ile)
        self.db.jconn.setAutoCommit(False)


